#include <cstdio>
#include <cstring>
#include <cmath>
#include <iostream>
using namespace std;
        
char buf[1 << 18], *fs, *ft;
char ops[1 << 18], *opt = ops, *const opt_end = ops + (1 << 18);
 
inline char getc() { 
    return (fs == ft && (ft = (fs = buf) + fread(buf, 1, 1 << 18, stdin)), fs == ft) ? EOF : *fs++;
}
 
inline int gn() { 
    int k = 0, f = 1;
    char c = getc();
    for(; !isdigit(c); c = getc()) if(c == '-') f = -1;
    for(; isdigit(c); c = getc()) k = k * 10 + c - '0';
    return k * f;
}
 
int p, fb[501], a[501];

void mul (int x[], int y[]) {
    static int tmp[501];
    memset(tmp, 0, sizeof(tmp));
    int ly = 500, lx = 500;
    while (!x[lx] && lx) lx--;
    while (!y[ly] && ly) ly--;
    for (int i = 1; i <= ly; i++) {
        for (int j = 1; j <= lx; j++) {
            if (i + j - 1 <= 500) {
                tmp[i + j - 1] += y[i] * x[j];
            }
        }
    }
    for (int i = 1; i <= 500; i++) {
        if (tmp[i] >= 10) {
            tmp[i + 1] += tmp[i] / 10;
            tmp[i] %= 10;
        }
    }
    memcpy(x, tmp, sizeof(a));
}

int main() { 
#ifndef LOCAL
    freopen("mason.in", "r", stdin);
    freopen("mason.out", "w", stdout);
#endif
    p = gn();
    printf("%d\n", (int) floor(p * log10(2) + 1));
    fb[1] = 1;
    a[1] = 2;
    for(; p; p >>= 1) {
        if(p & 1) mul(fb, a);
        mul(a, a);
    }
    fb[1]--;
    for(int i = 500; i; i--) {
        printf("%d", fb[i]);
        if(!((i - 1) % 50)) { 
            putchar('\n');
        }
    }
}
